package com.detech.sbom.base.mybatis.login.dao;

import com.detech.sbom.base.config.mybatis.BaseMapperPlus;
import com.detech.sbom.base.mybatis.login.entity.TbUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * 用户表
 * 
 * @author 方安伦
 * @email byzxedu@163.com
 * @date 2021-11-19 10:33:25
 */
@Mapper
public interface TbUserDao extends BaseMapperPlus<TbUserDao,TbUserEntity> {

    @Select("select * from tb_user t where t.username=#{username} and t.password=#{password}")
    TbUserEntity userLoginBySelect(String username, String password) ;

    TbUserEntity userLoginByXml(String username, String password) ;

    @Select("select u.username,count(o.ddbh) sl from tb_user u LEFT JOIN tb_order o on u.username=o.jlr GROUP BY u.username")
    Map loadUserOrderListMap() ;

    /**
     * 通过用户名查询用户
     * @param userName 用户名
     * @return 用户对象信息
     */
    TbUserEntity selectUserByUserName(String userName);

    /**
     * 通过微信openid查询用户
     *
     * @param openid 微信openid
     * @return 用户对象信息
     */
    TbUserEntity selectUserByOpenid(String openid);
}
